package cn.wen.eeayjoke.ui;

import android.view.View;
import android.widget.SeekBar;

import com.wen.update.UpdateUtils;
import com.wen.update.listener.OnUpdateListener;

import java.io.File;

import butterknife.BindView;
import cn.wen.core.http.OkHttpPresenter;
import cn.wen.core.titlebar.DefTitleBar;
import cn.wen.core.ui.AppActivity;
import cn.wen.eeayjoke.R;

/**
 * Created by Administrator on 2018/2/24.
 */

public class PullZoomTestActivity extends AppActivity {


    @BindView(R.id.seek_bar)
    SeekBar mSeekBar;
    OkHttpPresenter presenter = new OkHttpPresenter(getAppActivity());

    @Override
    protected Object getContentLayout() {
        return R.layout.activity_pull_zoom;
    }

    @Override
    protected void initTitle(DefTitleBar titleBar) {

    }

    public void load(View view) {
        String url = "http://imtt.dd.qq.com/16891/1F2132E5E6E671026297162EDAF28A80.apk?fsname=cn.carhouse.yctone_2.7.5_43.apk";
        UpdateUtils.update(this, url, "2.7.6", new OnUpdateListener() {
            @Override
            public void onFailed(String msg) {

            }

            @Override
            public void onSucceed(File apkFile) {

            }

            @Override
            public void onProgress(int total, int current, float progress) {
                mSeekBar.setProgress((int) progress);
            }
        });
//        presenter.download(url, "apk", "acxw.apk", new OkHttpFileCallback() {
//            @Override
//            public void onSucceed(File file) {
//                Toast.makeText(PullZoomTestActivity.this, "file", Toast.LENGTH_SHORT).show();
//            }
//
//            @Override
//            public void onProgress(float progress, float current, float total) {
//                mSeekBar.setProgress((int) progress);
//            }
//        });
    }

    public void cancel(View view) {
        presenter.cancel();
    }

}
